package com.sinochem.yunlian.ship.base.enume;

import java.util.HashMap;

import lombok.Getter;
import lombok.Setter;

/**
 * @Description: 货品等级
 */
public enum BaseMaterialCategoryLeve {

	ONE_LEVEL(1,"一级"),
	
	TWO_LEVEL(2,"二级"),
	
	THREE_LEVEL(3, "三级");
	
	
	@Setter
	@Getter
	private int level;
	
	@Setter
	@Getter
	private String message;
	
	private BaseMaterialCategoryLeve(int level, String message) {
		
		this.level = level;
		
		this.message = message;
	}
	
	/**
	 * 返回值
	 * @param code
	 * @return
	 */
	public static String returnMessage(Integer code) {
		
		if (code == null) {
			return null;
		}
		BaseMaterialCategoryLeve[] leves = BaseMaterialCategoryLeve.class.getEnumConstants();
		HashMap<Integer, String> hashMap = new HashMap<>(10);
		
		for (int i = 0; i < leves.length; i++) {
			hashMap.put(leves[i].getLevel(), leves[i].getMessage());;
		}
		
		return hashMap.get(code);
	}
	
	public static void main(String[] args) {
		System.out.println(returnMessage(3));
	}
}
